<template>
  <div class="content">
    <loading v-show="showLoading "></loading>
    <ul class="brand-list">
      <li class="brand-item" v-for="(item,index) in brandList" :key="index" @click = goBrandDetail(index)>
        <div class="brand-img">
          <img :src="item.brandImg" alt="">
        </div>
        <div class="brand-text">
          <div class="text-top">
            <span class="brand-title">{{item.brandName}}</span>
            <span class="brand-tip">{{item.brandContent}}</span>
          </div>
          <div class="text-bottom">
            <p class="explain">用你的心意为这个节日带去欢乐，更送给每个人一份美好的憧憬</p>
          </div>
        </div>
      </li>
    </ul>
  </div>


</template>

<script>
  import wx from 'weixin-js-sdk'
  import { wxHttpTool,wx_config, http_getParam, get_shopQrcoe,wx_share,wx_hideAllMenu } from '../../components/httpUtil/httpUtil'
  import {msg_10046} from '../../message/msg_10046'
export default {
  name: '',
  data () {
    return {
      brandList : [],
      showLoading : true
    }
  },
  methods:{
    goBrandDetail(index){
      localStorage.setItem('brand',JSON.stringify(
        this.brandList[index]
      ))
      // window.localStorage.brand=this.brandList[index]
      console.log()
      localStorage.setItem('FL',JSON.stringify({
        'fid':16, // 1级分类id
        'id':22, // 2级分类id
        'kindname':"手机配件"
      }))
      // this.$router.push({name: 'MemberList', params: {brandId: this.brandList[index].id}})
       this.$router.push('/branddetail')
    },
    fn10019(){
      const jsonValue = JSON.stringify({
        "c": "10019",
        "p": {
          "mallName": "",
          "tokenId":token(),
          "userId":JSON.parse(window.localStorage.data).id
        }
      });
      this.$http.post(api + '/qqs.us', jsonValue).then((res)=>{
        this.showLoading = false
        console.log(res)
        let data = res.data.p.mallBrandList
        this.brandList = data
      })
    }
  },
  created(){
    wxHttpTool.wxAuthor(this, function (varRet, varJson, varThis = this) {
      if (varRet == -1) {
        varThis.alertTip('网络错误');
        varThis.go = function () {
          varThis.showAlert = false;
        }

      }
      // 关注钱应该判断下是否已经关注过了
      msg_10046.send(varThis,msg_10046.entity(),function(varThis,res){
        varThis.wxlist=res.data.p.sign
        varThis.hideLoading();
        wx_config(varThis.wxlist);
        varThis.hideLoading();
        wx_hideAllMenu();
        wx.hideMenuItems({
          //禁用单独分享朋友圈QQ空间等功能
          menuList: ["menuItem:share:timeline","menuItem:share:QZone","menuItem:share:qq"] // 要隐藏的菜单项，所有menu项见附录3
        });
      })


    },this.type)
    this.fn10019();
  }
}
</script>

<style lang="scss" scoped>
  .content{
    .brand-list{
      background: #f4f4f4;
      .brand-item{
        background: #ffffff;
        height: 426px;
        margin-top: 20px;
        .brand-img{
          height: 260px;
          width: 100%;
          img{
            width: 100%;
            height: 100%;
          }
        }
        .brand-text{
          height: 166px;
          padding-left: 30px;
          padding-right: 32px;
          .text-top{
            padding-top: 14px;
            height: 46px;
            line-height:46px;
            .brand-title{
              float: left;
              font-size: 28px;
              color: #3b3b43;
            }
            .brand-tip{
              float: right;
              font-size: 24px;
              color: #fe3519;
            }
          }
          .text-bottom{
            font-size: 24px;
            color: #a1a1a1;
            line-height: 32px;
          }
        }
      }
      .brand-item:nth-of-type(1){
        margin-top: 0px;
      }
    }
  }

</style>
